﻿using System;
using AntsCode.AzureStorageBackup;
using Microsoft.WindowsAzure;

namespace WebTestHarness
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Button1_Click(object sender, EventArgs e)
        {
            var account = CloudStorageAccount.FromConfigurationSetting("StorageConnectionString");

            // Optionally specify tables & containers to be backed up first
            var priorityTables = new string[] { "Table1", "Table2" };
            var priorityContainers = new string[] { "Container1", "Container2" };

            var backup = new Backup(account, account, 5, priorityTables, priorityContainers);

            backup.BeginBackup();
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            var account = CloudStorageAccount.FromConfigurationSetting("StorageConnectionString");

            // Optionally specify tables & containers to be restored first
            var priorityTables = new string[] { "Table1", "Table2" };
            var priorityContainers = new string[] { "Container1", "Container2" };

            var restore = new Restore(account, account, TextBox1.Text, 5, priorityTables, priorityContainers);

            restore.BeginRestore();
        }
    }
}